package hdfs;

import java.io.IOException;
import java.io.InputStream;
import java.net.MalformedURLException;
import java.net.URL;

import org.apache.hadoop.fs.FsUrlStreamHandlerFactory;
import org.apache.hadoop.io.IOUtils;


public class URLConnectionTest {
	
	static{
		
		URL.setURLStreamHandlerFactory(new FsUrlStreamHandlerFactory());
	}

	public static void main(String[] args) throws MalformedURLException, IOException {
		
		InputStream in = new URL("hdfs://master:9000/user/hadoop/in/file1").openStream();
		IOUtils.copyBytes(in, System.err, 1024, false);
		IOUtils.closeStream(in);
	}
}
